home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
VISUALBA
/
GTICON.ZIP
/
GTICON.FRM
< prev
next >
Wrap
Text File
|
1993-11-06
|
6KB
|
195 lines
VERSION 2.00
Begin Form Form1
BorderStyle = 3 'Fixed Double
Caption = "GT Icon DLL"
ClientHeight = 3915
ClientLeft = 3795
ClientTop = 2340
ClientWidth = 4005
Height = 4320
Left = 3735
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 261
ScaleMode = 3 'Pixel
ScaleWidth = 267
Top = 1995
Width = 4125
Begin CommandButton cmd
Cancel = -1 'True
Caption = "Quit"
Height = 375
Index = 1
Left = 180
TabIndex = 1
Top = 2205
Width = 3660
End
Begin PictureBox pic
AutoRedraw = -1 'True
AutoSize = -1 'True
DragIcon = GTICON.FRX:0000
DragMode = 1 'Automatic
Height = 480
Left = 630
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 30
TabIndex = 2
TabStop = 0 'False
Top = 675
Width = 480
End
Begin CommandButton cmd
Caption = "Go"
Default = -1 'True
Height = 375
Index = 0
Left = 180
TabIndex = 0
Top = 1740
Width = 3660
End
Begin Label lbl
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "Drag the boxes below (Before)"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 240
Index = 3
Left = -30
TabIndex = 6
Top = 135
Width = 4005
End
Begin Label lbl
AutoSize = -1 'True
Caption = "AssignDragIcon"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 240
Index = 2
Left = 2235
TabIndex = 5
Top = 1230
Width = 1440
End
Begin Label lbl
AutoSize = -1 'True
Caption = "GetDragIcon"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 240
Index = 1
Left = 330
TabIndex = 4
Top = 1230
Width = 1140
End
Begin Label lbl
Alignment = 2 'Center
Caption = "This program illustrates the use of GTICON.DLL. Copyright (c) 1993 George R. Torralba"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 690
Index = 0
Left = 240
TabIndex = 3
Top = 2760
Width = 3525
End
Begin Image Image1
BorderStyle = 1 'Fixed Single
DragMode = 1 'Automatic
Height = 480
Left = 2655
Top = 675
Width = 480
End
End
' VB Project showing the use of:
'
' AssignDragIcon - Assign a handle to an icon (hIcon) to DragIcon property
' GetDragIcon - Get DragIcon property and assign it to an icon handle (hIcon)
'
' Copyright (c) 1993 George R. Torralba
'
DefInt A-Z
Dim hInst As Integer
Declare Function AssignDragIcon% Lib "gticon.dll" (ctrl As Control, ByVal hIcon%)
Declare Function GetDragIcon% Lib "gticon.dll" (ctrl As Control)
Const GWW_HINSTANCE = (-6)
Declare Function GetWindowWord% Lib "User" (ByVal hWnd%, ByVal nIndex%)
Declare Function ExtractIcon% Lib "shell.dll" (ByVal hisnt%, ByVal lpszExeName$, ByVal iIcon%)
Declare Function DrawIcon% Lib "User" (ByVal hDC%, ByVal x%, ByVal y%, ByVal hIcon%)
Declare Function DestroyIcon% Lib "User" (ByVal hIcon%)
Sub cmd_Click (Index As Integer)
Dim iDum As Integer, sbuf As String, hIcon As Integer
If Index = 1 Then
Unload Me
Exit Sub
End If
sbuf = "gticon.ico"
hIcon = ExtractIcon(hInst, sbuf, 0)
If (hIcon = 0) Or (hIcon = 1) Then
Beep
Exit Sub
End If
If (AssignDragIcon(Image1, hIcon)) Then
Image1.BorderStyle = 0
Image1 = Image1.DragIcon
End If
If hIcon <> 0 Then
iDum = DestroyIcon(hIcon)
End If
hIcon = GetDragIcon(pic)
If hIcon = 0 Then
Exit Sub
End If
pic.BorderStyle = 0
iDum = DrawIcon(pic.hDC, 0, 0, hIcon)
iDum = DestroyIcon(hIcon)
pic.Refresh
lbl(3) = "Drag the boxes below (After)"
End Sub
Sub Form_Load ()
hInst = GetWindowWord(Me.hWnd, GWW_HINSTANCE)
End Sub